// 节流函数
function throttle(fn, delay) {
    let timer = null;
    let start = new Date().getTime();
    return (...args) => {
        const current = new Date().getTime();
        if (current - start >= delay) {
            fn.apply(this, args);
            start = current;
        } else {
            timer = setTimeout(function () {
                fn.apply(this, args);
                cleartimeout(timer);
            }, delay);
        }
    }
}